UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YNs/5Ug3bqY90TmRWuyWBEpP2KUWpEfoFo4CkbqcFsg='
WHERE
key_id = 'd582c6ef14c98dd5c3aa97cdb296857cdb1da3fde893d577cd6b35f51eaded36'
AND (
token = 'YNs/5Ug3bqY90TmRWuyWBEpP2KUWpEfoFo4CkbqcFsg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)