UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gvqHMX4cZqt1TdKIy897XS40miFRfoAKAAN2ZEZ4idY='
WHERE
key_id = '53be961a3c8189b22c1f07b4f86cff23b63a3cf88f1c16dca98231868c8da698'
AND (
token = 'gvqHMX4cZqt1TdKIy897XS40miFRfoAKAAN2ZEZ4idY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)