UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't9gquWvIwasTQBvuNDfwFxQG9b2QOuBNICJ8cH1f2xY='
WHERE
key_id = 'a337e0bf48b01012265cf90eb6c5113893caa18d8b3f73bf5da5d1af0a674b58'
AND (
token = 't9gquWvIwasTQBvuNDfwFxQG9b2QOuBNICJ8cH1f2xY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)