UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W69jcFzTNru5MXcedBEEbkrRKKSsgGxfEIoWk9XG+EQ='
WHERE
key_id = 'e5e2060aef95dd849ce05c3c52abb77cb3f9c38b8ab4ed9a6fcc86537b085586'
AND (
token = 'W69jcFzTNru5MXcedBEEbkrRKKSsgGxfEIoWk9XG+EQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)