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