UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GJ/843S4xHXRocP6T6ylUOsfTTuQ3uYPuzHvAKPkV9A=' 
WHERE 
  key_id = '4559f420aecf6ffd5123615c9918709673a57e913dd8328771f5d1d50141806c' 
  AND (
    token = 'GJ/843S4xHXRocP6T6ylUOsfTTuQ3uYPuzHvAKPkV9A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047