UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EqJpzYZdj+cYryaFnPJDeXvcbxJ39mB8VPYRDQtsAwY=' 
WHERE 
  key_id = '57e1fadebf314aa246c0c9d2236d3fbcc652e7e473fa827a9823a1a7df3807fe' 
  AND (
    token = 'EqJpzYZdj+cYryaFnPJDeXvcbxJ39mB8VPYRDQtsAwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028