UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7PsCdxv/e681Bi9FZnGpajZ9mfGhE5uOAuc0LkO7vts='
WHERE
key_id = 'f23243472b890b1bd198c888deac5eb1c3c3d9aba3fe5b4a0910475a70ca7b91'
AND (
token = '7PsCdxv/e681Bi9FZnGpajZ9mfGhE5uOAuc0LkO7vts='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)