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