UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i5RaO2ALoTH41NDB/szyWlzzU3hA4wEM76Am+X0Rj2U=' 
WHERE 
  key_id = '96d561026a93c28d4e95c0c4b0b3c8435b918cadecc71e6ce21d0bc3f2c03af8' 
  AND (
    token = 'i5RaO2ALoTH41NDB/szyWlzzU3hA4wEM76Am+X0Rj2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026