UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OwiULLarXPBQBIj3aOQP4LRpGF8Bp0akcy0JYutrznk=' 
WHERE 
  key_id = '790051840d78a0a0b16847b82f8272f8bfcfd97a6a68351c4472a67f6f8fc1c1' 
  AND (
    token = 'OwiULLarXPBQBIj3aOQP4LRpGF8Bp0akcy0JYutrznk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033