UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CP4zuPUWaKew7vzPjcx4y/wY2uy+T2ebLyx4egaIwWs=' 
WHERE 
  key_id = 'a1ee48e22213992f1b2a2c11c796bd8409c992c18ca64f8edc43a86024aad2be' 
  AND (
    token = 'CP4zuPUWaKew7vzPjcx4y/wY2uy+T2ebLyx4egaIwWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024