UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YlvItID+wAMIhcTPbZ9dXvt8dyP8TqJQAM7zW8VSmH0='
WHERE
key_id = '1fabb01b0c485fe233c11176934d267f5b4505ff1f5c7783c820746f03aa9c6b'
AND (
token = 'YlvItID+wAMIhcTPbZ9dXvt8dyP8TqJQAM7zW8VSmH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)