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