UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ahIkG5895nNKVf9Fy332NhzR+73N/oYaSCJS8zMbgc='
WHERE
key_id = 'd9021e478f0aace19b32bd317605c7b777c2b75b660556b433659759763d18ee'
AND (
token = '7ahIkG5895nNKVf9Fy332NhzR+73N/oYaSCJS8zMbgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)