UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fByFksoukKmuovLPoyB69MDBit1+o0jXDGsTypmlSuY='
WHERE
key_id = '47c5c55747b4c34b67f41e123a8962917fbd6f3b393b8845ded8a8526960ef39'
AND (
token = 'fByFksoukKmuovLPoyB69MDBit1+o0jXDGsTypmlSuY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)