UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PTNDMJoYvQE19JZk3nC9FO0TUGqFAOP+i5tvBOjBYno='
WHERE
key_id = '6b8de7998945065c179e98c7b8c415b7543e690bb363a98960da2e6b011100bb'
AND (
token = 'PTNDMJoYvQE19JZk3nC9FO0TUGqFAOP+i5tvBOjBYno='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)