UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j0lweWLPqF8cnYzcbtw6IHvI2Khh7t1JvEcFamzua7I='
WHERE
key_id = 'a7db4560a29a87b7f86435d0aca82f798492cb39b95aa0c042aadf1d6f711bd6'
AND (
token = 'j0lweWLPqF8cnYzcbtw6IHvI2Khh7t1JvEcFamzua7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)