UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iq8XHeq/jsDpiQD+5+IsfRT8WWdlD8qz+0f9k8R3ycE=' 
WHERE 
  key_id = '94ac5284062c3908b70283a371448a61bcbcc75f8d5098803db3f05f12017017' 
  AND (
    token = 'iq8XHeq/jsDpiQD+5+IsfRT8WWdlD8qz+0f9k8R3ycE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041