UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D0aHdn8RzzYIgLyJJ0HTw/ZOZ6ztSlMXi6VcVYm0lIw='
WHERE
key_id = 'a5929f1953b7ae613312efa0b56b6ba71e99105f5e89c78e2780452a3e1c06bd'
AND (
token = 'D0aHdn8RzzYIgLyJJ0HTw/ZOZ6ztSlMXi6VcVYm0lIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)