UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6E6ZY8/UC79vjICMBM9IFaU7Ays3cAc+hXVAAEFxlJk='
WHERE
key_id = '251ba55346f0366701da243bec30f6dc7ed6ebc4353e2b1fb607d707fbc919fb'
AND (
token = '6E6ZY8/UC79vjICMBM9IFaU7Ays3cAc+hXVAAEFxlJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)