UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qX5nqM25fW2wLlB8tazGBz4+jlnAWHPWdU/NHg3h6Pg=' 
WHERE 
  key_id = 'a710631de90747b8ef8fa9ac50349fe0b9aff6fbad5328f1f22f56adb18c1058' 
  AND (
    token = 'qX5nqM25fW2wLlB8tazGBz4+jlnAWHPWdU/NHg3h6Pg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032