UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IaPi0jWe9xvfIwxEi83WRox6c2hcvrS96fSlBOFSFtQ='
WHERE
key_id = '488e4c6a1c0b85016b0cb37c499e64e55acbe2754c899f95d1835b801effc3ef'
AND (
token = 'IaPi0jWe9xvfIwxEi83WRox6c2hcvrS96fSlBOFSFtQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)