UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iut6W7k8K32lJWSDz4q2zrgCWVCEgviC9tnHB3Oh+io=' 
WHERE 
  key_id = '03933e6888722665ba5ca1ab308e76a529f28184b8f6587d006deb68e21b8279' 
  AND (
    token = 'Iut6W7k8K32lJWSDz4q2zrgCWVCEgviC9tnHB3Oh+io=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045