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