UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm/EBp7wBN3roqcNK1gS6iI8rG+zVEfZm7nMj7voeZzY=' 
WHERE 
  key_id = '2945968c095b27919c39acbc60586c6410bbed9eb1edc242d4f1542d0f5845ab' 
  AND (
    token = 'm/EBp7wBN3roqcNK1gS6iI8rG+zVEfZm7nMj7voeZzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027