UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BbSuxL7Qnsb1NIX673y5kW21LRgFEXvyI+CF0Tc47j0='
WHERE
key_id = '0e4bd68053adf982d75921eded0ba136c63cca2cbb8e0a59c36b6aba339d60f7'
AND (
token = 'BbSuxL7Qnsb1NIX673y5kW21LRgFEXvyI+CF0Tc47j0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)