UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2eStqfRh3D5v5zeY4fS0FQH74dHGoI6rqjoeoDOV+xU='
WHERE
key_id = '047a5d21d5b2d5f25be57132a15db4f751afcb6ae9e626086291493d9fbddadb'
AND (
token = '2eStqfRh3D5v5zeY4fS0FQH74dHGoI6rqjoeoDOV+xU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)