UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g5pBeOSq9la4lQfGwcQY0/sjkuKy6uxxDFWOpBH8m3c=' 
WHERE 
  key_id = '309b710effeaa534f5b9f770ff9e9171707a9563b8ce5c9014992ab0cea44b94' 
  AND (
    token = 'g5pBeOSq9la4lQfGwcQY0/sjkuKy6uxxDFWOpBH8m3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034