UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ykyXI99hEva0y/eWmfemvLEbd0Zz+T99ZPWqEtfgrgA='
WHERE
key_id = '3a659ea507b214d11e0b735a328e1643261ac58a3a5de2d062915508c1a70906'
AND (
token = 'ykyXI99hEva0y/eWmfemvLEbd0Zz+T99ZPWqEtfgrgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)