UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hpz6Z7d3Zo5V8trU3pVRPcUv5K1fk26Ar0dJNyI7/Xc=' 
WHERE 
  key_id = '9b640186b079c9ee825bf078c09192b211d8195b2848d8d4efeed40e36f0b979' 
  AND (
    token = 'hpz6Z7d3Zo5V8trU3pVRPcUv5K1fk26Ar0dJNyI7/Xc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034