UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vKngpv9w5TDPO4+q12oAkmBCtuiX/aT1DLzzr4CtdKk=' 
WHERE 
  key_id = 'aa276d08235183ecfb328c321b9deae6662e20eea6e4502ddb1588779d4cc3f6' 
  AND (
    token = 'vKngpv9w5TDPO4+q12oAkmBCtuiX/aT1DLzzr4CtdKk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030