UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9s5qDG4PEKstHShRLkBtS3/icwsiJW64gyL950OzuWY='
WHERE
key_id = 'c6e3017ad9d145f617e6f95ccd49640a34fd8616e9df32c4074762688fa17332'
AND (
token = '9s5qDG4PEKstHShRLkBtS3/icwsiJW64gyL950OzuWY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)